-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External EN bonds itp #596
base: master
Are you sure you want to change the base?
Conversation
- added extra argument in martinize2 - added conditionals for workflow in apply_rubber_band.py - added write out for bonds in gmx/topology.py
- added new argument to calls of ApplyRubberBand in test_apply_rubber_band.py - changed handling of _rubber_bands in apply_rubber_band.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the feature.
As for the implementation, I have the following suggestion: Don't have the RubberBands processor return the bonds, instead just add them to the molecule. The ITP writer can then select which interactions to write where based on some sort of selector. This would also allow it to write the appropriate #include
statement. This will at some point also allow you to easily write other bonds or I don't know, dihedrals to external files. It'll also make the BondParam
namedtuple superfluous.
if eb_write: | ||
rubber_band = BondParam(atoms = (from_key, to_key), | ||
btype=bond_type, | ||
length=length, | ||
fc=force_constant, | ||
meta={'group': 'Rubber band'}) | ||
ebs.append(rubber_band) | ||
else: | ||
molecule.add_interaction( | ||
type_='bonds', | ||
atoms=(from_key, to_key), | ||
parameters=[bond_type, length, force_constant], | ||
meta={'group': 'Rubber band'}, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fewer if statements is better, so I suggest always gathering the rubber band interactions into a list, and at the end decide whether or not you add the interactions to the molecule or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thanks! Do you want them in a list from here, or to add directly to the molecule with appropriate meta to identify later? Probably don't have time to implement this week but I can have a think about how to edit what
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add them to the molecule directly, and find them again later based on the meta attributes.
if -ew specified, change the interaction type of the added EN bonds so that they are processed once martinize2 gets to the itp writing. - change conditionals in apply_rubber_band.py so that interaction type is changed depending on how network is to be written - move writing functionality from topology.py to itp.py - itp.py ids interaction type for elastic network to be written externally and writes as appropriate.
ok, I think this is closer to how you want this to be handled? But, I don't think either of us are happy with this solution, so I'll keep working at something cleaner edit: ok, so this is failing the integration test because there's now an #include written halfway through a file that the parser can't handle... |
Jup, definitely in the right direction. My original idea was to not add an extra interaction type ('el_bonds'), but rather, iterate over interactions and grouping them using some form of selection function. For example, all interactions that have Also, the |
Add a flag,
-ew
, to write out bonds for elastic networks to an external en_bonds.itp file, in the style of Go or Olive bonds.This has been motivated by some work on visualising cg molecules at martini_vis for now. If the bonds are written out externally, then they can be used (after some editing elsewhere) to visualise the elastic network separately to the bonds inherent in the molecule. Maybe this is useful, maybe it isn't, it's a feature at least!
pros:
cons:
#include "en_bonds.itp"
in their[ bonds ]
directive in their molecule's itp file